package com.hnit.care.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.HashMap;
import java.util.Map;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Msg {
    // 100 成功 200 失败
    private Integer code;

    //提示信息
    private String msg;

    //客户要返回给浏览器的数据
    private Map<String,Object> extending = new HashMap<>();

    public static Msg success(){
        Msg result = new Msg();
        result.setCode(100);
        result.setMsg("处理成功");
        return result;
    }

    public Msg add(String key,Object value){
        this.getExtending().put(key, value);
        return this;
    }
}
